<template>
    <div v-if="detailsVisible">
        <el-collapse v-model="activeNames"  accordion>
            <el-collapse-item  name="1">
                <template slot="title"> {{typeA}} {{typeBB}} 历次记录<i class="header-icon el-icon-info" style="margin-left: 10px;"></i></template>
                <div>
                    <dfrecoder ref='dfrecoder' v-on:serchrecorder="serchrecorderback"   v-on:dbshowdfRecoder="dbclickrecoder" v-on:gettab="childtypechange" :typeA="typeA" :typeB="typeB"></dfrecoder>
                </div>
            </el-collapse-item> 
            <el-collapse-item  name="2"  v-show="disabledTwo"> 
                <template slot="title">
                    {{typeBB}}  结果
                    <Badge dot v-if="hasnewfile==true">
                        <Icon type="ios-albums"  style="margin-left: 10px;"></Icon>
                    </Badge>
                    <Icon type="ios-albums"  style="margin-left: 10px;" v-if="hasnewfile==false"></Icon>
                </template>
                <div v-if="typeBB=='党费管理-党费收缴'">
                    <dfshoujiao ref='dfshoujiao' ></dfshoujiao>
                </div>
                <div v-if="typeBB=='党费管理-党费使用'">
                    <dfshiyong ref='dfshiyong'></dfshiyong>
                </div>
            </el-collapse-item>
            <el-collapse-item  name="3"  v-show="disabledTwo"> 
                <template slot="title">
                  {{typeB}} 相关文件
                    <Badge dot v-if="hasnewfile==true">
                        <Icon type="ios-albums"  style="margin-left: 10px;"></Icon>
                    </Badge>
                    <Icon type="ios-albums"  style="margin-left: 10px;" v-if="hasnewfile==false"></Icon>
                </template>
                <showfiles ref="showfiles" :Tabs="showTabs"></showfiles>
            </el-collapse-item>
        </el-collapse>
        
    </div>
</template>

<script>
    import {mapActions} from 'vuex';
    export default {
        data: () => ({
            detailsVisible:true,
            activeNames:'1',


            
            typeA:'',
            typeB:'',
            hasnewfile:false,
            disabledTwo:false,


            typeBB:'',



            recoder:'',



            yearOryearmonth:false,
            Modalvisible:false,
            showallFileds:false,

            year:0,
            month:0,
            showTabs:[],

        }),
        mounted() {
            
        },
        watch: {
             "recoder": {
                handler(n) {
                    if(this.recoder!=''){
                        this.disabledTwo=true;
                    }
                    else
                    {
                        this.disabledTwo=false;
                    }
                },
                deep: true
            }, 
        },
        components: {
            dfrecoder: function(resolve) {require(["./dfrecoder.vue"], resolve);},
            dfshoujiao: function(resolve) {require(["./dfshoujiao.vue"], resolve);},
            dfshiyong: function(resolve) {require(["./dfshiyong.vue"], resolve);},
        },
        methods: {
            ...mapActions(['GetUser','GetZbById','GetActiveDwId_DzbId']),
            serchrecorderback(recoders){
                this.disabledTwo=false;
                this.activeNames='1';
            },
            dbclickrecoder(recoder,time){
                this.recoder=recoder;
                this.disabledTwo=true;
                this.activeNames='2';
                if(this.typeBB=='党费管理-党费收缴'){
                    this.$refs.dfshoujiao.$data.rowdata.year=time;

                }
                else if(this.typeBB=='党费管理-党费使用'){
                    this.$refs.dfshiyong.$data.rowdata.year=time;
                }
                this.$refs.showfiles.$data.Filerecode=recoder;
                this.showTabs=[
                    {title: '上级文件'},
                    {title: '本级文件'},
                ];
                this.$refs.showfiles.$data.columns={
                    normal:
                    [
                        {
                            prop:'time',
                            width:'155',
                            label:'来文时间',
                        },
                        {
                            prop:'bianhao',
                            width:'155',
                            label:'文件编号',
                        },
                        {
                            prop:'name',
                            width:'155',
                            label:'文件名称',
                        },
                        {
                            prop:'jieguo',
                            width:'155',
                            label:'办理结果',
                        },
                        {
                            prop:'store',
                            width:'125',
                            label:'实际存放',
                        },
                    ],
                    showstatus:{
                        show:true,
                        prop:'status',
                        width:'125',
                        label:'办理状态',
                    },
                    showcontent:{
                        show:true,
                        prop:'content',
                        width:'125',
                        label:'内容查看',
                    },
                    showdownload:{
                        show:true,
                        prop:'truesrc',
                        width:'125',
                        label:'内容下载',
                    }
                }
            },
            childtypechange(childtype){
                this.typeBB=childtype;
            },




            




            ////////////
            showallFiledsF(){
                this.showallFileds=!this.showallFileds;
            },
            showallFiledsF(){
                this.showallFileds=!this.showallFileds;
            },
            serchfileA(){
                this.recoderfiles=[]; this.showdataB();
                let _this=this;
                let postdata={
                    type:"serchdangfei",
                    split:JSON.stringify({
                        dwid:this.$store.state.Dw_DzbID.dwid,
                        dzbid:this.$store.state.Dw_DzbID.dzbid,
                        year:this.year,
                        month:this.month
                    })
                }
                let AjaxPostSyncdata=this.$Common.AjaxPostSync(postdata,true)
                if(AjaxPostSyncdata.Data.dfeis.length==0){
                    _this.$message({
                        message:'没有找到记录',
                        type:'info'
                    });
                }
                else{
                    let dfeis=AjaxPostSyncdata.Data.dfeis;
                    for (let index = 0; index < dfeis.length; index++) {
                        const element = dfeis[index];
                        let postdata_element={
                            type:"selectdfeitime",
                            split:JSON.stringify({
                                dwid:element.dwid,
                                dzbid:element.dzbid,
                                year:element.year,
                                month:element.month
                            })
                        }
                        let AjaxPostSyncdata2=this.$Common.AjaxPostSync(postdata_element,true).Data;
                        if(AjaxPostSyncdata2==null){
                            element.truesrc='';
                        }
                        else{
                            element.needJiao2=AjaxPostSyncdata2.needJiao;
                            element.trueJiao2=AjaxPostSyncdata2.trueJiao;
                            element.uploadtime=AjaxPostSyncdata2.time;
                            element.stroe=AjaxPostSyncdata2.stroe;
                            element.truesrc=AjaxPostSyncdata2.truesrc;
                        }
                        
                        this.recoderfiles.push(element);
                    }
                    this.showdataB();
                }
            },
        }
    }
</script>
<style>
.el-menu-demo2{
height: 900px;
    background: #e0e0e0;
    color: white;
    width: 150px;
    font-size: 14px;
}
</style>